﻿@model DateTime?

@{
   var cssClass = "form-control datepicker";
   if (ViewData["class"] != null)
   {
       cssClass += " " + ViewData["class"];
   }
   
   var attr = new Dictionary<string, object>
   {
       {"class", cssClass},
       {"data-val", "false"}
   };
}

@if (ViewData["disabled"] != null && (bool)ViewData["disabled"])
{
    attr.Add("disabled", "disabled");
}

@(Model.HasValue ? Html.TextBox(string.Empty, Model.Value.ToString("dd.MM.yyyy"), attr) : Html.TextBox("", "", attr))